import os
import sys
import django
from channels.routing import get_default_application
import uvicorn

# 添加父目录到 Python 路径
current_dir = os.path.dirname(os.path.abspath(__file__))
parent_dir = os.path.dirname(current_dir)
sys.path.append(parent_dir)

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ai.settings')
django.setup()

if __name__ == "__main__":
    uvicorn.run(
        "ai.asgi:application",
        host="127.0.0.1",
        port=8008,
        reload=True
    ) 